import  react  from  "react"
import  "../css/nav.css"
class   Nav  extends  react.Component{
  constructor(props){
    super(props)
    this.state={
      list:["李白","韩信","霍康","瑶妹"],
    }
  }
 render() {
    return(
      <div>
          <ul>
          {
            this.state.list.map((element,index)=>{
              return  <li   className={this.state.enterIndex == index ? 'b1' : 'b2'} key={index} onClick={()=>{  
                this.setState({
                  enterIndex: index
                })
              }}
              >{element}
              </li>
            })
          }
          </ul>
      </div>
    )
 }
}
export default Nav;